Fix: some bugs when text input reaches max_tokens of language_model #11669
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix 1: RandomSamplingNegPos forget to remove gt_ignore_flags
在https://github.com/open-mmlab/mmdetection/blob/dev-3.x/mmdet/datasets/transforms/formatting.py#L109 中,会根据valid_idx = np.where(results['gt_ignore_flags'] == 0)[0]来获得valid_idx,并通过valid_idx从gt_bboxes中取得有效的bboxes。
在https://github.com/open-mmlab/mmdetection/blob/dev-3.x/mmdet/datasets/transforms/text_transformers.py#L62 中,如果positive labels的token数之和超过了256,会随机删掉一部分gt_bboxes和gt_labels,但是没有对gt_ignore_flags进行相应的处理,导致在PackDetInputs中,通过valid_idx从gt_bboxes中取得有效的bboxes会出现index越界error。
参考RandomCrop中处理gt_ignore_flags的方式对RandomSamplingNegPos进行相应的修改